package com.stox.shared.core.model;

import java.util.LinkedHashMap;

public class Cache<K, V> extends LinkedHashMap<K, V> {
	private static final long serialVersionUID = 1L;
	
	private final int maxEntries;
	
	public Cache(int maxEntries) {
		this.maxEntries = maxEntries;
	}

	@Override
	protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) {
		return size() > maxEntries;
	}
	
}
